package com.rd.student.jike.class2.xuezhixin.day0731;

import java.util.ArrayList;

public class Work03 {

    // list 方法一

    public static void main(String[] args) {

        int[] arr = new int[50];
        for(int i = 0;i<50;i++){
            arr[i] = i;
        }

        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0;i<20;i++){
            int subscript = (int) (Math.random() * arr.length);
            if(list.contains(subscript)){
                i--;
                continue;
            }
            list.add(subscript);
        }
        System.out.println(list);
        System.out.println(list.size());
    }
}
